package pl.edu.mimuw.irs.core.model.analysis;

import java.util.Comparator;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;

import pl.edu.mimuw.irs.core.model.petrinet.Transition;

@Deprecated
public class SimpleRandomizer implements Iterable<Transition> {

	// *** Attributes
	private Set<Transition> elements;

	// *** Constructors
	
	public SimpleRandomizer(Set<? extends Transition> set) {
		this.elements = new TreeSet<Transition>(new RandomComparator());
	}
	
	// *** Methods

	@Override
	public Iterator<Transition> iterator() {
		return elements.iterator();
	}
	
	private class RandomComparator implements Comparator<Transition> {

		private Random random = new Random();
		
		@Override
		public int compare(Transition o1, Transition o2) {
			return random.nextInt(2) - 1;
		}
		
	}
}
